const express = require("express");
const router = express.Router();
const goodsHandler = require("../router_handler/goods");
const expressJoi = require("@escook/express-joi");
const { get_list_schema, get_byName_schema, get_byListId_schema, get_byId_schema } = require("../schema/goods");

// 获取商品列表路由
router.get("/getList", expressJoi(get_list_schema), goodsHandler.getList);

// 通过商品名称获取商品列表路由
router.get("/getByName", expressJoi(get_byName_schema), goodsHandler.getByName);

// 通过商品的分类 id 来获取商品列表路由
router.get("/getByType", expressJoi(get_byListId_schema), goodsHandler.getByType);

// 通过商品 ID 来获取商品的详情
router.get("/getById", expressJoi(get_byId_schema), goodsHandler.getById);

// 获取新品
router.get("/getByTime", goodsHandler.getByTime);

// 获取热销商品
router.get("/getByHot", goodsHandler.getByHot);

module.exports = router;